perm filename EFROP.C[11,HE] blob
sn#688194 filedate 1982-12-06 generic text, type T, neo UTF8
/* LINTLIBRARY */
/*
* efrecopen.c
*
* EFTP Package
*
* EfRecOpen -- open an eftp channel for receiving a file on standard
* EFTP socket.
*
* EfRecOpenS -- open an eftp channel for receiving a file on specified
* socket.
*
* Jeffrey Mogul @ Stanford 11-February-1981
*
* Jeffrey Mogul @ Stanford 13 August 1982
* - added EfRecOpenS
*/
#include <eftp.h>
#include <pupconstants.h>
#include <pupstatus.h>
/*
* Open EFTP receiver channel on standard EFTP socket
*/
EfRecOpen(Efchan,Sender,timeout,bswap)
struct EftpChan *Efchan; /* address of empty EftpChan */
struct Port *Sender; /* destination host/net */
int timeout; /* channel timeout in seconds */
int bswap; /* 1=byte-swap, 0= don't */
/* swapping wrt NSO */
{
return(EfRecOpenS(Efchan, Sender, timeout, bswap, EFTPSERVER));
}
EfRecOpenS(Efchan,Sender,timeout,bswap,OurSocket)
struct EftpChan *Efchan; /* address of empty EftpChan */
struct Port *Sender; /* destination host/net */
int timeout; /* channel timeout in seconds */
int bswap; /* 1=byte-swap, 0= don't */
/* swapping wrt NSO */
Socket OurSocket; /* local socket */
{ /* */
int opstat;
Efchan->sequence = 0;
Efchan->WaitTime = timeout;
Efchan->remport.host = Sender->host;
Efchan->remport.net = Sender->net;
Efchan->remport.socket = 0;
opstat = pupopen(&Efchan->pchan,OurSocket,&Efchan->remport);
if (opstat != OK)
return(opstat);
pupsettimeout(&Efchan->pchan,ONESEC*timeout);
#ifdef PUP__NNSO
if (bswap) /* means fix up last word */
pupsetmode(&Efchan->pchan,
PCM_WCHECKSUM+PCM_RCHECKSUM+PCM_RFIXLAST);
else /* no need for fixup */
pupsetmode(&Efchan->pchan,
PCM_WCHECKSUM+PCM_RCHECKSUM+PCM_NORFIXLAST);
#else /* don't byteswap wrt NSO */
pupsetmode(&Efchan->pchan,PCM_WCHECKSUM+PCM_RCHECKSUM);
#endif
pupsetdfilt(&Efchan->pchan,64);
if (bswap)
Efchan->ef_mode = EFTPM_RECEIVE|EFTPM_BYTESWAP;
else /* no byte-swaping */
Efchan->ef_mode = EFTPM_RECEIVE;
return(OK);
}